﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace BtoBSWT315.Company
{
    public partial class top : System.Web.UI.UserControl
    {
        public string WebUrl, uID, lblcompany;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                title();
            }
        }
        public void title()
        {

            if (Request.QueryString["ID"] != null)
            {
                int uid = int.Parse(Request.QueryString["ID"]);
                Admin.Admin_ClassDb classdb = new Admin.Admin_ClassDb();
                string sql = "select cimg,qymc,web,id from qyml where  id=" + uid + "";
                DataTable dt = classdb.GetTables(sql);

                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["cimg"].ToString() != "" && dt.Rows[0]["cimg"].ToString() != null)
                    {
                        lblLogo.ImageUrl = GetImageUrl(dt.Rows[0]["cimg"].ToString());
                        // .Text = "<img src=../" + dt.Rows[0]["cimg"].ToString() + " border=0 width=83 height=73/>";
                    }
                    lblcompany = dt.Rows[0]["qymc"].ToString();
                    uID = dt.Rows[0]["id"].ToString();
                    WebUrl = Convert.ToString(dt.Rows[0]["web"].ToString());
                }
            }
        }


        protected string GetImageUrl(string imgUrl)
        {
            imgUrl = imgUrl.Replace("..", "~/");
            imgUrl = imgUrl.Replace("\\", "/");
            imgUrl = imgUrl.Trim();
            return imgUrl;
        }
    }
}